<template>
	<view>
		<uni-nav-bar left-icon="back" left-text="返回" :border="false" title="高龄津贴申请详情"
		 status-bar fixed @clickLeft="backLastPage" >
		</uni-nav-bar>
		<view class="px-4">
			<uni-steps :options="stepData.options" direction="column" :active="stepData.active"></uni-steps>
		</view>
	</view>
</template>

<script>
	import uniNavBar from '@/components/uni/uni-nav-bar/uni-nav-bar.vue';
	import uniSteps from '@/components/uni/uni-steps/uni-steps.vue'
	
	export default {
		components: {
			uniNavBar,
			uniSteps
		},
		data () {
			return {
				stepData: {
					options: [],
					active: 0
				}
			}
		},
		async onLoad () {
			const res = await this.$api.UserProcessInfo({});
			console.log(res)
			if (res.data.code === 200) {
				const obj = res.data.result.processStep;
				for (let key in obj) {
					if (obj[key].handleTime === null) {
						this.stepData.options.push({title: obj[key].taskName, desc: '正在审核中'});
					} else {
						this.stepData.options.push({title: obj[key].taskName, desc: obj[key].handleTime});
					}
					if (obj[key].handleType === '2') {
						this.stepData.active ++;
					}
				}
				this.stepData.options.push({title:'申请成功',desc:'通过'});
				if (obj.handleType === '3') {
					this.stepData.active ++;
				}
			}
		},
		methods: {
			backLastPage () {
				uni.navigateBack({
				    delta: 1
				});
			}
		}
	}
</script>

<style>

</style>
